<html xmlns:th="http://www.thymeleaf.org">
<html>
  <head>
    <base href="<%=basePath%>">
    <meta charset="UTF-8">
    <title>编辑客户</title>
    
	<meta name="pragma" content="no-cache">
	<meta name="cache-control" content="no-cache">
	<meta name="content-type" content="text/html;charset=UTF-8">
	<meta name="expires" content="0">
	  <link href="../../../../static/easyui/themes/insdep/easyui.css" rel="stylesheet" type="text/css">
	  <link href="../../../../static/easyui/themes/insdep/easyui_animation.css" rel="stylesheet" type="text/css">
	  <link href="../../../../static/easyui/themes/insdep/easyui_plus.css" rel="stylesheet" type="text/css">
	  <link href="../../../../static/easyui/themes/insdep/insdep_theme_default.css" rel="stylesheet" type="text/css">
	  <link href="../../../../static/easyui/themes/insdep/icon.css" rel="stylesheet" type="text/css">
	  <link href="../../../../static/easyui/themes/color.css" rel="stylesheet" type="text/css">

	  <link href="../../../../static/ztree/zTreeStyle/zTreeStyle.css" rel="stylesheet" type="text/css" >
	  <link href="../../../../static/css/common.css" rel="stylesheet" type="text/css" >

	  <script type="text/javascript" src="../../../../static/jquery/jquery.min.js"></script>
	  <script type="text/javascript" src="../../../../static/easyui/jquery.easyui.min.js"></script>
	  <script type="text/javascript" src="../../../../static/easyui/themes/insdep/jquery.insdep-extend.min.js"></script>
	  <script type="text/javascript" src="../../../../static/ztree/jquery.ztree.all.min.js"></script>
	  <script type="text/javascript" src="../../../../static/easyui/easyui-lang-zh_CN.js"></script>
	  <script type="text/javascript" src="../../../../static/kindeditor/kindeditor-all-min.js"></script>
    <link href="http://www.easyui-extlib.com/Content/Site.css" rel="stylesheet" />
    <script src="http://www.easyui-extlib.com/Scripts/jquery-extensions/jquery.jdirk.js"></script>
    <link href="http://www.easyui-extlib.com/Scripts/jquery-easyui-extensions/validatebox/jeasyui.extensions.validatebox.css" rel="stylesheet" />
    <script src="http://www.easyui-extlib.com/Scripts/jquery-easyui-extensions/validatebox/jeasyui.extensions.validatebox.rules.js"></script>
    
  </head>
   <style>
  	*{
  		margin-left: 10px;
  		padding: 3px;	
  	}
  	.tip{
  		
  		height:30px;
  		text-align: right;
  		background-color: #F5F5F5;
  	}
  </style>

  <body>
  	<form id="newCustomer" method="post">
  		<input type="hidden" name="id" th:value="${customerVO.id }">
  		<input type="hidden" name="customerVO.isDeleted" value="${false}">
  		<input type="hidden" name="customerVO.isLocked" value="${false }">
  		<input type="hidden" name="customerVO.contactId" value="${customerVO.contactId }">
  		<input type="hidden" name="customerVO.contactCreateUserId" value="${customerVO.contactCreateUserId }">
  		<input type="hidden" name="customerVO.contactCreateTime" value="${customerVO.contactCreateTime }">
  		<input type="hidden" name="customerVO.createUserId" value="${customerVO.createUserId }">
  		<input type="hidden" name="customerVO.createTime" value="${customerVO.createTime}">
    <table>
    	<tr>
    		<td colspan="4">主要信息</td>
    	</tr>
    	<tr>
    		<td class="tip">负责人：</td>
    		<td>
				<select id="owner" name="ownerUserId" style="width:146px;height:32px" data-options="required:true">
    				<option>--请选择--</option>
<!--					<option th:each="users:${userList}" th:value="${users.id}" th:text="${users.username}"></option>-->
					<option th:each="user:${userList}" th:selected="${user.id}==${customerVO.ownerUserId}" th:value="${user.id}" th:text="${user.username}"></option>
    			</select>&nbsp;
				<a href="javascript:void(0);" class="easyui-linkbutton button-white">放入客户池</a>
			</td>
    		<td class="tip">客户名称：</td>
    		<td><input name="name" th:value="${customerVO.name }"class="easyui-textbox easyui-validatebox" data-options="validType:['chinese'],required:true"/></td>
    	</tr>
    	<tr>
    		<td class="tip">客户行业：</td>
    		<td><input name="industry" th:value="${customerVO.industry }" class="easyui-textbox easyui-validatebox" data-options="required:true"/></td>
    		<td class="tip">客户信息来源：</td>
    		<td><input name="origin" th:value="${customerVO.origin }" class="easyui-textbox easyui-validatebox" data-options="required:true"/></td>
    	</tr>
    	<tr>
    		<td class="tip">公司性质：</td>
    		<td><input type="radio" name="ownership" th:value="合资" th:checked="${customerVO.ownership =='合资' ? true : false}" >合资&nbsp;
	    		<input type="radio" name="ownership" th:value="国企" th:checked="${customerVO.ownership =='国企' ? true : false}">国企&nbsp;
	    		<input type="radio" name="ownership" th:value="民营" th:checked="${customerVO.ownership =='民营' ? true : false}">民营</td>
    		<td class="tip">邮编：</td>
    		<td><input name="zipCode" th:value="${customerVO.zipCode }" class="easyui-textbox easyui-validatebox" data-options="validType:['zipCode'],required:true"/></td>
    	</tr>
    	<tr>
    		<td class="tip">年营业额：</td>
    		<td><select class="easyui-combobox" name="annualRevenue" style= "width:146px">
    				<option value="-1">-请选择-</option>
    				<option th:value="1000万-3000万" th:selected="${customerVO.annualRevenue == '1000万-3000万'?  true : false }">1000万-3000万</option>
    				<option th:value="3000万-6000万" th:selected="${customerVO.annualRevenue == '3000万-6000万'?  true : false }">3000万-6000万</option>
    				<option th:value="6000万-9000万" th:selected="${customerVO.annualRevenue == '6000万-9000万'?  true : false }">6000万-9000万</option>
    			</select></td>
    		<td class="tip">评分：</td>
    		<td><input type="radio" name="rating" th:value="一星" th:checked="${customerVO.rating == '一星' ? true : false}">一星&nbsp;
    			<input type="radio" name="rating" th:value="二星" th:checked="${customerVO.rating == '二星' ? true : false}">二星&nbsp;
    			<input type="radio" name="rating" th:value="三星" th:checked="${customerVO.rating == '三星' ? true : false}">三星</td>
    	</tr>
    	<tr>
    		<td class="tip">客户联系地址：</td>
    		<td colspan="3">
    			<input id="addr1" class="easyui-textbox easyui-validatebox" style="width:100px" data-options="prompt:'省',required:true">
    			<input id="addr2" class="easyui-textbox easyui-validatebox" style="width:100px" data-options="prompt:'市',required:true">
    			<input id="addr3" class="easyui-textbox easyui-validatebox" style="width:100px" data-options="prompt:'区',required:true">
    			<input id="addr4" class="easyui-textbox easyui-validatebox" data-options="prompt:'具体街道信息',required:true">
    			<input id="address" name="address" type="hidden">
    		</td>
    	</tr>
    	<tr>
    		<td colspan="4" style="text-align: center;">
    			<a id="save" href="javascript:void(0);" class="easyui-linkbutton button-purple" >修改</a>
    		</td>
    	</tr>
    </table>
    </form>
  </body>
  <script type="text/javascript">
  	$(function(){
  		//修改回显地址
  		var address = "[[${customerVO.address}]]";
  		address = address.split("-");
  		$("#addr1").textbox({"value":address[0]});
  		$("#addr2").textbox({"value":address[1]});
  		$("#addr3").textbox({"value":address[2]});
  		$("#addr4").textbox({"value":address[3]});
  		
  		$("#save").on("click",function(e){
  			var addr1 = $("#addr1").val();
  			var addr2 = $("#addr2").val();
  			var addr3 = $("#addr3").val();
  			var addr4 = $("#addr4").val();
  			var addr = addr1+"-"+addr2+"-"+addr3+"-"+addr4;
  			$("#address").val(addr);

			$.post("/customerEdit",
					$("#newCustomer").serialize(),
					function(data){
						$.messager.alert({
							title:"提示",
							msg:data.msg,
						})
						// location.href = "/toList";
					},"json")
  		})
  	})
  </script>
</html>

